package com.itheima.common;

/**
 * @author Gareth Cao
 * @date 2022/4/28 10:27
 */

/**
 * 这个类用于存取session中的 id值
 */
public class BaseContext {
    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    public static void setCurrentId(Long id) {
        //在当前线程设置数据
        threadLocal.set(id);
    }

    public static Long getCurrentId() {
        //从当前线程获取数据
        return threadLocal.get();
    }
}
